#include <iostream>

using namespace std;

//交换函数

//值传递
void myswap01(int a, int b)
{
    int temp = a;
    a = b;
    b = temp;
}
//地址传递
void myswap02(int *a, int *b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}
//引用传递
void myswap03(int &a,int&b)
{
    int temp = a;
    a = b;
    b = temp;
}

int main(void)
{
    int a = 10;
    int b = 20;
    myswap01(a, b);

    cout << "a = " << a << endl;
    cout << "b = " << b << endl;

    myswap02(&a, &b);

    cout << "a = " << a << endl;
    cout << "b = " << b << endl;

    myswap03(a, b);

    cout << "a = " << a << endl;
    cout << "b = " << b << endl;


    return 0;
}